package com.jnshu.service;

import com.jnshu.dto.person.UserDto;
import com.jnshu.pojo.User;
import com.jnshu.tools.resultUtils.PageBean;
import com.jnshu.tools.resultUtils.ResultBean;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "person",url = "http://localhost:20823")
public interface PersonService {

    //前台微信登录
    @GetMapping(value = "/u/login/code")
    UserDto userLogin(@RequestParam("code") String code);

    //前台发送手机验证码
    @PostMapping(value = "/u/phone/code")
    ResultBean sendPhoneCode(@RequestParam("phone")String phone);

    //绑定手机号码
    @PostMapping(value = "/u/phone/binding")
    ResultBean phoneBinding(@RequestParam("phone")String phone,
                            @RequestParam("code")String code,
                            @RequestParam("id")long id);

    //前台发送邮箱验证码
    @PostMapping(value = "/u/my/email/code")
    ResultBean sendEmailCode(@RequestParam("email")String email);

    //绑定邮箱
    @PostMapping(value = "/u/my/email/binding")
    ResultBean emailBinding(@RequestParam("email")String email,
                            @RequestParam("code")String code,
                            @RequestParam("id")long id);

    //前台签到页
    @PostMapping(value = "/u/signing")
    ResultBean signPage(@RequestParam("id")Long id);

    //前台页签到
    @PutMapping(value = "/u/signing")
    ResultBean sign(@RequestParam("id")Long id);

    //前台每日任务
    @GetMapping(value = "/u/signing/task")
    ResultBean everydayTask(@RequestParam("id")Long id);

    //前台每日任务状态
    @GetMapping(value = "/u/signing/details")
    ResultBean everydayTaskStatus(@RequestParam("id")Long id);

    //前台消息列表
    @GetMapping(value = "/message/ulist")
    ResultBean uSelectMessage(@RequestParam(value = "pagaSize",required = false) Integer pageSize,
                              @RequestParam(value = "pageNum",required = false)Integer pageNum
                              ,@RequestParam(value = "userId") long userId);

    //前台消息详情
    @GetMapping("/umessage")
    ResultBean uSelectId(@RequestParam(value = "id")Long id,@RequestParam(value = "userId")long userId);

    //一键阅读
    @GetMapping("/umessage/read")
    ResultBean selectRead(@RequestParam(value = "userId")Long userId);


    //前台个人中心
    @PostMapping(value ="/u/my")
    ResultBean selectMyPersonById(@RequestParam(value = "id")Long id);

    //个人资料
    @PostMapping(value ="/u/my/information")
    ResultBean selectMyInfoById(@RequestParam(value = "id")Long id);

    //修改个人资料
    @PutMapping(value = "/u/my/information",produces = {"application/json;charset=UTF-8"})
    ResultBean myPersonUpdate(@RequestBody User user);

    @GetMapping(value = "/u/my/binding")
    ResultBean bindingUserInfo(@RequestParam(value = "id")Long id);

    //个人中心收藏列表
    @GetMapping(value ="/u/my/collection")
    PageBean myCollection(@RequestParam(value = "classify",required = false)Integer classify,
                          @RequestParam(value = "pageNum",required = false,defaultValue ="1") Integer pageNum,
                          @RequestParam(value = "pageSize",required =false,defaultValue ="10") Integer pageSize,
                          @RequestParam(value = "userId",required = false) long userId);

    @GetMapping(value ="/u/my/history")
    ResultBean myHistory(@RequestParam(value = "type",required = false)Integer type,
                            @RequestParam(value = "pageNum",required = false,defaultValue ="1") Integer pageNum,
                            @RequestParam(value = "pageSize",required =false,defaultValue ="10") Integer pageSize,
                            @RequestParam(value = "userId",required = false) long userId);

    //取消收藏
    @DeleteMapping(value = "/u/my/collection")
    ResultBean deleteCollection(@RequestParam(value = "courseId") long courseId,
                                @RequestParam(value = "userId") long userId);

    @DeleteMapping(value = "/u/my/collection/more")
    ResultBean deleteMoreCollection(@RequestParam(value = "userId") long userId,
                                    @RequestParam(value = "courseId") String courseId,
                                    @RequestParam(value = "status") String status);

    //删除浏览记录
    @DeleteMapping(value = "/u/my/history")
    ResultBean deleteHistory(@RequestParam(value = "userId") long userId);
}
